package com.advertise.testing;

import com.advertise.strutsAction.LoginPageAction;
import com.advertise.tool.ApplicationHelper;
import com.advertise.tool.GlobalUser;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class TestInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation actionInvocation) throws Exception {
		
		Object action = actionInvocation.getAction();
		
		GlobalUser user = (GlobalUser)ApplicationHelper.getSessionValue("globalUser");
		
		System.out.println(user);
		if(user!=null){
			return actionInvocation.invoke();
		}
		
		else{		
			return "global_login";
		}
		
	}

}
